﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="get_data_chart.aspx.cs" Inherits="SQT.tracnghiem.Ajax.ASP.Accountant.get_data_chart" %>

<%@ Import Namespace="DataAccess" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<body>
    <%
        int id = int.Parse(Request.QueryString["id"]);
        int month = int.Parse(Request.QueryString["month"]);
        int year = int.Parse(Request.QueryString["year"]);
        string data = "";
        var get_staff = from p in new TblManagerController().FetchAll() orderby p.Role ascending where (p.Role == id && p.Active == true) select p;
        foreach (TblManager chk in get_staff)
        {
            data = "";
            for (int i = 0; i < 31; i++)
            {
                int ca = 0;
                var get_data = new TblCheckManagerController().FetchAll().Where(x => x.ManagerId == chk.ManagerId && DateTime.Parse(x.CheckIn.ToString()).Month == month && DateTime.Parse(x.CheckIn.ToString()).Year == year && DateTime.Parse(x.CheckIn.ToString()).Day == i + 1 && x.Accept == true && x.Absent == false);
                if (get_data.ToList().Count != 0)
                {
                    ca = get_data.ToList().Count;
                }
                data += ca;
                if (i < 30)
                    data += ",";

            } %>
    <div class="data"><%=data %></div>

    <%} %>
</body>
</html>
